<?php if (!defined('BASEPATH')) exit('No direct script access allowed');

class Date_format{
	function Date_format(){
		$this->CI = &get_instance();
		$this->CI->load->helper('date');
	}
	
	function formatMYSQLDate( $date ){
		if( empty($date) || preg_match('/[0-9]{4}-[0-9]{2}-[0-9]{2}/', $date)){
			return $date;
		}else{
			if( preg_match('/[0-9]{4}-[0-9]{2}/', $date)){
				return $date . '-' . '00';
			}else{
				if( preg_match('/[0-9]{4}/', $date)){
					return $date . '-00-00';
				}else{
					return '';
				}
			}
		}
	}
}

?>